package com.itheima.dao;

import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.example.Orders;

public interface OrdersMapper {
    @Select("select * from tb_orders where users_id = #{id}")
    Orders selectOrders(int id);

    @Select("select * from tb_orders where id = #{id}")
    @Results({@Result(property = "id",column = "id"),
            @Result(property = "productList",column = "id"
            ,many = @Many(select = "com.itheima.dao.productMapper.selectProductByOrdersId"))})
    Orders selectOrdersById(int id);
}
